home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / bbs / qwkp9611.zip / QWK.TXT < prev    next >
Text File  |  1996-11-02  |  53KB  |  1,179 lines

  1.                      QWK Mail Packet File Layout
  2.                           by Patrick Y. Lee
  3.  
  4. Version 1.6 - December 19, 1992
  5.      Added off-line commands for QSO (door for TBBS), thanks to
  6.      message from Bob Hartman in the FidoNet Off-line echo.  All
  7.      8-bit characters have been replaced with either blanks or
  8.      equivalent 7-bit characters so I can send this file easily via
  9.      Internet email.  Line 9 of the CONTROL.DAT file seems to be
  10.      used by a few doors to indicate the NetMail conference.
  11. Version 1.5 - July 30, 1992
  12.      Added off-line commands for Cam-Mail door.  Fixed error in the
  13.      status flag section.  The descriptions for `*' and `+' are
  14.      incorrect.  Thanks to Bob Blaylock for bringing this up.
  15. Version 1.4 - July 18, 1992
  16.      Fixed a few minor mistakes in the documentation (thanks to
  17.      Cody Gibson).  Nothing really major.  Also completed the
  18.      Netmail section of the documentation.
  19. Version 1.3 - July 6, 1992
  20.      Added changes to the QWK format adopted by Qmail door.  Spe-
  21.      cifically line 10 of CONTROL.DAT file and bytes 126-127 of
  22.      MESSAGES.DAT file.  Please refer to the appropriate section
  23.      for the changes.
  24. Version 1.2 - May 31, 1992
  25.      Added a few items to the DOOR.ID file that is being supported
  26.      by Qmail DeLuxe2 version 1.25.
  27. Version 1.1 - March 15, 1992
  28.      Minor fixes here and there to make everything just right.
  29. Version 1.0 - February 23, 1992
  30.      First release.
  31.  
  32. This document is Copyright 1992 by Patrick Y. Lee.
  33.  
  34. The QWK-format is Copyright 1987 by Sparkware.
  35.  
  36. All program names mentioned in this document are either Copyright
  37. or Trademark of respective owners.
  38.  
  39. The author provides this file as-is without warranty of any kind,
  40. either expressed or implied.  You are using the information in this
  41. file at your own discretion.  The author assumes no responsibili-
  42. ties for damages, either physically or financially, from the use of
  43. this information.
  44.  
  45. This document may be freely distributed by any means (electronical-
  46. ly, paper, etc.), provided that it is distributed in its entirety. 
  47. Portions of this document may be reproduced without credit.
  48.  
  49.                     -=-=-=-=-=-=-<>-=-=-=-=-=-=-
  50.  
  51.                           Table of Contents
  52.  
  53. 1.  Introduction
  54.     1.1.  Intent
  55.     1.2.  History
  56.     1.3.  Questions, corrections, etc.
  57. 2.  Conventions & overview
  58.     2.1.  The BBS ID
  59.     2.2.  Packet compression
  60.     2.3.  Packet transfer & protocols
  61.     2.4.  Limitations
  62. 3.  QWK files
  63.     3.1.  Naming convention
  64.     3.2.  Control file (CONTROL.DAT)
  65.     3.3.  Welcome file
  66.     3.4.  Goodbye file
  67.     3.5.  News file
  68.     3.6.  Qmail DeLuxe2 menu file
  69.     3.7.  New uploads listing (NEWFILES.DAT)
  70.     3.8.  Bulletin file(s) (BLT-x.y)
  71.     3.9.  Message file (MESSAGES.DAT)
  72.     3.10.  Index files (*.NDX)
  73.         3.10.1.  Conference indices
  74.         3.10.2.  Personal index (PERSONAL.NDX)
  75.     3.11.  Pointer file
  76.     3.12.  SESSION.TXT
  77. 4.  REP files
  78.     4.1.  Naming convention
  79.     4.2.  Message file (BBSID.MSG)
  80.     4.3.  Door control messages
  81.     4.3.1.  DOOR.ID file
  82.     4.3.2.  Qmail
  83.     4.3.3.  MarkMail
  84.     4.3.4.  KMail
  85.     4.3.5.  RoseMail
  86.     4.3.6.  Complete Mail Door
  87.     4.3.7.  The MainMail System
  88.     4.3.8.  BGQWK
  89.     4.3.9.  UltraBBS
  90.     4.3.10.  TriMail
  91.     4.3.11.  Cam-Mail
  92.     4.3.12.  QSO
  93.     4.3.13.  TGWave
  94.     4.4.  Turning off the echo flag
  95.     4.5.  Tag-lines
  96. 5.  Net mail
  97. A.  Credits & contributions
  98. B.  Sample Turbo Pascal and C code
  99. C.  Sample message
  100. D.  Sample index file
  101.  
  102.                     -=-=-=-=-=-=-<>-=-=-=-=-=-=-
  103.  
  104. To search for a specific section, look for "[x.x]" using your edi-
  105. tor or viewer.  For example, to jump to the tag-lines portion of
  106. this file, search for "[4.5]" with your editor or text viewer.
  107.  
  108.                     -=-=-=-=-=-=-<>-=-=-=-=-=-=-
  109.  
  110. [1]  Introduction
  111.  
  112. [1.1]  Intent
  113.  
  114. This document is written to facilitate programmers who want to write
  115. QWK-format mail doors or readers.  It is intended to be a comprehen-
  116. sive reference covering all areas of QWK-format mail processing. 
  117. Detailed break down of each file is included, as are implementation
  118. information.  In addition, door and reader specific information may be
  119. included, when such information are available to me.
  120.  
  121. [1.2]  History
  122.  
  123. The QWK-format was invented by Mark "Sparky" Herring in 1987.  It was
  124. based on Clark Development Corporation's PCBoard version 12.0 message
  125. base format.  Off-line mail reading has become popular only in recent
  126. years.  Prior to summer of 1990, there were only two QWK-format off-
  127. line mail reader programs.  They were Qmail DeLuxe by Mark Herring and
  128. EZ-Reader by Eric Cockrell.  Similarly for the doors, there were only
  129. two -- Qmail by Mark Herring and MarkMail by Mark Turner.  They were
  130. both for PCBoard systems.
  131.  
  132. A lot has changed in both off-line reader and mail door markets since
  133. summer 1990.  Now, there are more than a dozen off-line mail readers
  134. for the PC.  Readers for the Macintosh, Amiga, and Atari exist as
  135. well.  There are over a half dozen doors for PCBoard, and QWK-format
  136. doors exist for virtually all of the popular BBS softwares.  All of
  137. these happened in less than two years!  More readers and doors are in
  138. development as I write this, keep up the excellent work.  In addition
  139. to doors, some BBS softwares has QWK-format mail facility built in.
  140.  
  141. Off-line mail reading is an integral part of BBS calling.  Conference
  142. traffic and selection on all networks have grown dramatically in re-
  143. cent years that on-line reading is a thing of the past.  Off-line mail
  144. reading offers an alternative to reading mail on-line -- It offers
  145. speed that cannot be achieved with on-line mail reading.
  146.  
  147. The reason why QWK-format readers and doors seem to have gained popu-
  148. larity is probably dued to its openness.  The format is readily avail-
  149. able to any programmer who wishes to write a program that utilize it. 
  150. Proprietary is a thing of the past, it does not work!  Openness is
  151. here to stay and QWK-format is a part of it.
  152.  
  153. [1.3]  Questions, corrections, etc.
  154.  
  155. Most of the message networks today have a conference/echo devoted to
  156. discussion of off-line readers and mail doors.  The ones I know are on
  157. FidoNet, ILink, Intelec, and RIME.  If you have questions after read-
  158. ing anything in here, feel free to drop by any of the above conference
  159. /echo and I am sure other QWK authors will try to help.
  160.  
  161. I can be reached at:
  162.  
  163. CompuServe: >INTERNET:patlee@panix.com
  164. FidoNet: Off-line echo
  165. ILink: Off-line conference
  166. Intelec: Off-line conference
  167. Internet: patlee@panix.com
  168. PlanoNet: Reviews conference
  169. RIME: ->RUNNINGB, Off-line, Common, Net Admin., Shareware, New Users,
  170. and Session Manager conferences
  171.  
  172. Any corrections, extensions, comments, and criticisms are welcomed. 
  173. Messages from Internet and RIME will probably be answered first.  But
  174. I do check mail on all other places at least once a week.
  175.  
  176. [2]  Conventions & overview
  177.  
  178. All offsets referenced in this document will be relative to 1.  I am
  179. not a computer, I start counting at one, not zero!
  180.  
  181. Words which are enclosed in quotes should be entered as-is.  The quo-
  182. tations are not part of the string unless noted.
  183.  
  184. You may have noticed I use the phrase "mail program" or "mail facili-
  185. ty" instead of mail doors.  This is because some BBS softwares offer
  186. the option of creating QWK-format mail packets right from the BBS. 
  187. With those, there is no need for an external mail door.
  188.  
  189. [2.1]  The BBS ID
  190.  
  191. The BBS ID (denoted as BBSID) is a 1-8 characters word that identifies
  192. a particular BBS.  This identifier should be obtained from line 5 of
  193. the CONTROL.DAT file (see section 3.2.1).
  194.  
  195. [2.2]  Packet compression
  196.  
  197. Most mail packets are compressed when created by the mail door in
  198. order to save download time and disk space.  However, many off-line
  199. reader programs allow the user to unarchive a mail packet outside of
  200. the reader program, so the reader will not have to unarchive it.  Upon
  201. exit, the reader will not call the archiver to save it.  It is up to
  202. the user to archive the replies.  This is useful if the user has lim-
  203. ited memory and cannot shell out to DOS to run the unarchive program. 
  204. For readers based on non-PC equipment, the user may be using less
  205. common compression program that does not have command line equivalent.
  206.  
  207. [2.3]  Packet transfer & protocols
  208.  
  209. There is no set rule on what transfer protocol should be used.  Howev-
  210. er, it would be nice for the mail program on the BBS to provide the
  211. Sysop with options as to what to offer.  This should be a configura-
  212. tion option for the user.
  213.  
  214. [2.4]  Specifications & limitations
  215.  
  216. There aren't many known limits in the QWK specification.  However,
  217. various networks seem to impose artificial limits.  On many of the PC-
  218. based networks, 99-lines appears to be the upper limit for some
  219. softwares.  However, most of the readers can handle more than that. 
  220. Reader authors reading this may want to offer the option to split
  221. replies into n lines each (the actual length should be user definable
  222. so when the network software permits, the user can increase this num-
  223. ber).
  224.  
  225. [3]  QWK files
  226.  
  227. [3.1]  Naming convention
  228.  
  229. Generally, the name of the mail packet is BBSID.QWK.  However, this
  230. does not have to be the case.  When the user downloads more than one
  231. mail packet at one time, either the mail program or the transfer pro-
  232. tocol program will rename the second and subsequent mail packets to
  233. other names.  They will either change the file extension or add a
  234. number to the end of the filename.  In either case, you should not
  235. rely on the name of the QWK file as the BBSID.  The BBSID, as men-
  236. tioned before, should be obtained from line 5 of the CONTROL.DAT file. 
  237. In addition, mail packets do not have to end with QWK extension ei-
  238. ther.  The user may choose to name them with other file extensions.
  239.  
  240. [3.2]  Control file (CONTROL.DAT)
  241.  
  242. The CONTROL.DAT file is a simple ASCII file.  Each line is terminated
  243. with a carriage return and line feed combination.  All lines should
  244. start on the first column.
  245.  
  246. Line #
  247.  1   My BBS                   BBS name
  248.  2   New York, NY             BBS city and state
  249.  3   212-555-1212             BBS phone number
  250.  4   John Doe, Sysop          BBS Sysop name
  251.  5   20052,MYBBS              Mail door registration #, BBSID
  252.  6   01-01-1991,23:59:59      Mail packet creation time
  253.  7   JANE DOE                 User name (upper case)
  254.  8                            Name of menu for Qmail, blank if none
  255.  9   0                        ? Seem to be always zero.  A few doors,
  256.                               such as DCQWK for TAG is using this
  257.                               field to indicate the conference where
  258.                               Fido NetMail should be placed.  This
  259.                               gives the reader program the ability
  260.                               easily send NetMail.
  261. 10   999                      Total number of messages in packet
  262. 11   121                      Total number of conference minus 1
  263. 12   0                        1st conf. number
  264. 13   Main Board               1st conf. name (13 characters or less)
  265. 14   1                        2nd conf. number
  266. 15   General                  2nd conf. name
  267. ..   3                        etc. onward until it hits max. conf.
  268. ..   123                      Last conf. number
  269. ..   Amiga_I                  Last conf. name
  270. ..   HELLO                    Welcome screen file
  271. ..   NEWS                     BBS news file
  272. ..   SCRIPT0                  Log off screen
  273.  
  274. Some mail doors, such as MarkMail, will send additional information
  275. about the user from here on.
  276.  
  277. 0                             ?
  278. 25                            Number of lines that follow this one
  279. JANE DOE                      User name in uppercase
  280. Jane                          User first name in mixed case
  281. NEW YORK, NY                  User city information
  282. 718 555-1212                  User data phone number
  283. 718 555-1212                  User home phone number
  284. 108                           Security level
  285. 00-00-00                      Expiration date
  286. 01-01-91                      Last log on date
  287. 23:59                         Last log on time
  288. 999                           Log on count
  289. 0                             Current conference number on the BBS
  290. 0                             Total KB downloaded
  291. 999                           Download count
  292. 0                             Total KB uploaded
  293. 999                           Upload count
  294. 999                           Minutes per day
  295. 999                           Minutes remaining today
  296. 999                           Minutes used this call
  297. 32767                         Max. download KB per day
  298. 32767                         Remaining KB today
  299. 0                             KB downloaded today
  300. 23:59                         Current time on BBS
  301. 01-01-91                      Current date on BBS
  302. My BBS                        BBS network tag-line
  303. 0                             ?
  304.  
  305. Some mail doors will offer the option of sending an abbreviated con-
  306. ference list.  That means the list will contain only conferences the
  307. user has selected.  This is done because some mail readers cannot
  308. handle more than n conferences at this time.  Users using those read-
  309. ers will need this option if the BBS they call have too many confer-
  310. ences.
  311.  
  312. [3.3]  Welcome file
  313.  
  314. This file usually contains the log on screen from the BBS.  The exact
  315. filename is specified in the CONTROL.DAT file, after the conference
  316. list.  This file may be in any format the Sysop chooses it be -- usu-
  317. ally either in plain ASCII or with ANSI screen control code.  Some
  318. Sysops (notably PCBoard Sysops) may use BBS-specific color change code
  319. in this file as well.  Current mail programs seem to handle the trans-
  320. lations between BBS-specific code to ANSI based screen control codes.
  321.  
  322. Even if the CONTROL.DAT file contains the filename of this file, it
  323. may not actually exist in the mail packet.  Sometimes, users will
  324. manually delete this file before entering the mail reader.  Some off-
  325. line readers offer the option to not display this welcome screen; some
  326. will display this file regardless.  Some doors, similarly, will offer
  327. option to the user to not send this file.
  328.  
  329. [3.4]  Goodbye file
  330.  
  331. Similar to the welcome file above, the filename to the goodbye file is
  332. in the CONTROL.DAT file.  This is the file the BBS displays when the
  333. user logs off the board.  It is optional, as always, to send this file
  334. or to display it.
  335.  
  336. [3.5]  News file
  337.  
  338. Many mail doors offer the option to send the news file from the BBS. 
  339. Most will only send this when it has been updated.  Like the welcome
  340. and goodbye files, the filename to the news file is found in the CON-
  341. TROL.DAT file.  It can be in any format the Sysop chooses, but usually
  342. in either ASCII or ANSI.  Like the welcome screen, current mail facil-
  343. ities seem to handle translation between BBS-specific control codes to
  344. ANSI screen control codes.
  345.  
  346. [3.6]  Qmail DeLuxe2 menu file
  347.  
  348. This file is of use only for Qmail DeLuxe2 mail reader by Sparkware. 
  349. The filename is found on line 8 of the CONTROL.DAT file.
  350.  
  351. [3.7]  New uploads listing (NEWFILES.DAT)
  352.  
  353. Most mail programs on the BBS will offer the option to scan new files
  354. uploaded to the BBS.  The result is found in a file named
  355. NEWFILES.DAT.  The mail program, if implementing this, should update
  356. the last file scan field in the user's profile, if there is such a
  357. field, as well as other information required by the BBS.  The mail
  358. program should, of course, scan new files only in those areas the user
  359. is allowed access.
  360.  
  361. [3.8]  Bulletin files (BLT-x.y)
  362.  
  363. Most mail programs will also offer the option to include updated bul-
  364. letin files found on the BBS in the mail packet.  The bulletins are
  365. named BLT-x.y, where x is the conference/echo the bulletin came from,
  366. and y the bulletin's actual number.  The mail program will have to
  367. take care of updating the last read date on the bulletins in the user
  368. record.
  369.  
  370. [3.9]  Message file (MESSAGES.DAT)
  371.  
  372. The MESSAGES.DAT file is the most important.  This is where all of the
  373. messages are contained in.  The QWK file format is based on PCBoard
  374. 12.0 message base format from Clark Development Corporation (maker of
  375. PCBoard BBS software).
  376.  
  377. The file has a logical record length of 128-bytes.  The first record
  378. of MESSAGES.DAT always contain a copyright notice saying "Produced by
  379. Qmail...Copyright (c) 1987 by Sparkware.  All Rights Reserved".  The
  380. rest of the record is space filled.  Actual messages consist of a 128-
  381. bytes header, plus one or more 128-bytes block with the message text. 
  382. Actual messages start in record 2.  The header block is layed out as
  383. follows:
  384.  
  385. Offset  Length  Description
  386. ------  ------  ----------------------------------------------------   
  387.     1       1   Message status flag (unsigned character)
  388.                 ' ' = public, unread
  389.                 '-' = public, read
  390.                 '*' = private, read by someone but not by intended
  391.                 recipient
  392.                 '+' = private, read by official recipient
  393.                 '~' = comment to Sysop, unread
  394.                 '`' = comment to Sysop, read
  395.                 '%' = sender password protected, unread
  396.                 '^' = sender password protected, read
  397.                 '!' = group password protected, unread
  398.                 '#' = group password protected, read
  399.                 '$' = group password protected to all
  400.     2       7   Message number (in ASCII)
  401.     9       8   Date (mm-dd-yy, in ASCII)
  402.    17       5   Time (24 hour hh:mm, in ASCII)
  403.    22      25   To (uppercase, left justified)
  404.    47      25   From (uppercase, left justified)
  405.    72      25   Subject of message (mixed case)
  406.    97      12   Password (space filled)
  407.   109       8   Reference message number (in ASCII)
  408.   117       6   Number of 128-bytes blocks in message (including the
  409.                 header, in ASCII; the lowest value should be 2, header
  410.                 plus one block message; this number may not be left
  411.                 flushed within the field)
  412.   123       1   Flag (ASCII 225 means message is active; ASCII 226
  413.                 means this message is to be killed)
  414.   124       2   Conference number (unsigned word)
  415.   126       2   Logical message number in the current packet; i.e.
  416.                 this number will be 1 for the first message, 2 for the
  417.                 second, and so on. (unsigned word)
  418.   128       1   Indicates whether the message has a network tag-line
  419.                 or not.  A value of '*' indicates that a network tag-
  420.                 line is present; a value of ' ' (space) indicates
  421.                 there isn't one.  Messages sent to readers (non-net-
  422.                 status) generally leave this as a space.  Only network
  423.                 softwares need this information.
  424.  
  425. Fields such as To, From, Subject, Message #, Reference #, and the like
  426. are space padded if they are shorter than the field's length.
  427.  
  428. The message text starts in the next record.  You can find out how many
  429. blocks make up one message by looking at the value of "Number of 128
  430. byte blocks".  Instead of carriage return and line feed combination,
  431. each line in the message end with an ASCII 227 (pi character) symbol. 
  432. There are reports that some (buggy) readers have problems with messag-
  433. es which do not end the last line in the message with an ASCII 227. 
  434. If a message does not completely occupy the 128-bytes block, the re-
  435. mainder of the block is padded with space or null.
  436.  
  437. Note that there seems to exist old doors which will use one byte to
  438. represent the conference number and pad the other one with an ASCII 32
  439. character.  The program reading this information will have to deter-
  440. mine whether the ASCII 32 in byte 125 of the header is a filler or
  441. part of the unsigned word.  One method is to look in the CONTROL.DAT
  442. file to determine the highest conference number.
  443.  
  444. Even though most mail programs will generate MESSAGES.DAT files that
  445. appear in conference order, this is not always the case.  Tomcat!
  446. (mail door for Wildcat! BBS) generates MESSAGES.DAT that is not in
  447. conference order.  This is due to how Wildcat! itself stores mail on
  448. the BBS.  Another known system that behaves this way is Auntie, which
  449. has its mail door QWiKer.
  450.  
  451. Note that some mail doors offer the option of sending a mail packet
  452. even though there may be no messages to send -- thus an empty MESSAG-
  453. ES.DAT file.  This was tested with Qmail 4.0 door and it sent a MES-
  454. SAGES.DAT file that contains a few empty 128-bytes blocks.  Other mail
  455. doors seem to be able to produce QWK files without the MESSAGES.DAT
  456. file at all!  Apparently, there was no standard established in this
  457. procedure.
  458.  
  459. [3.10]  Index files (*.NDX)
  460.  
  461. [3.10.1]  Conference indices
  462.  
  463. The index files contain a list of pointers pointing to the beginning
  464. of messages in the MESSAGES.DAT file.  The pointer is in terms of the
  465. 128-bytes block logical record that the MESSAGES.DAT file is in.  Each
  466. conference has its own xxx.NDX file, where xxx is the conference num-
  467. ber left padded with zeroes.  Some mail programs offer the user the
  468. option to not generate index files.  So the mail readers need to cre-
  469. ate the index files if they are missing.
  470.  
  471. EZ-Reader 1.xx versions will convert the NDX files from Microsoft MKS
  472. format into IEEE long integer format.  The bad part about this is that
  473. the user may store those index files back into the QWK file.  When
  474. another reader reads the index files, it will be very confused!
  475.  
  476. Special note for BBSes with more than 999 conferences: Index files for
  477. conferences with four digit conference numbers is named xxxx.NDX,
  478. where xxxx is the conference number (left padded with zeroes).  The
  479. filenames for three digit conferences are still named xxx.NDX on these
  480. boards.  I would assume filenames for conferences in the five digit
  481. range is xxxxx.NDX, but I have not seen a BBS with 10,000 or more
  482. conferences yet!
  483.  
  484. Each NDX file uses a five bytes logical record length and is formatted
  485. to:
  486.  
  487. Offset  Length  Description
  488. ------  ------  ------------------------------------------------------
  489.     1       4   Record number pointing to corresponding message in
  490.                 MESSAGES.DAT.  This number is in the Microsoft MKS$
  491.                 BASIC format.
  492.     5       1   Conference number of the message.  This byte should
  493.                 not be used because it duplicates both the filename of
  494.                 the index file and the conference # in the header.  It
  495.                 is also one byte long, which is insufficient to handle
  496.                 conferences over 255.
  497.  
  498. Please refer to appendix B for routines to deal with MKS numbers.
  499.  
  500. [3.10.2]  Personal index (PERSONAL.NDX)
  501.  
  502. There is a special index file named PERSONAL.NDX.  This file contains
  503. pointers to messages which are addressed to the user, i.e. personal
  504. messages.  Some mail door and utility programs also allow the selec-
  505. tion of other messages to be flagged as personal messages.
  506.  
  507. [3.11]  Pointer file
  508.  
  509. Pointer file is generally included so that the user can reset the last
  510. read pointers on the mail program, in case there is a crash on the BBS
  511. or some other mishaps.  There should be little reason for the reader
  512. program to access the pointer file.
  513.  
  514. The pointer files I have seen are:
  515.  
  516. KMail          BBSID.PNT
  517. MarkMail       BBSID.PNT
  518. Qmail          BBSID.PTR
  519. QWiKer         HMP.PTR
  520. SFMailQwk      BBSID.SFP
  521.  
  522. Additions to this list are welcomed.
  523.  
  524. [3.12]  SESSION.TXT
  525.  
  526. This file, if included, will contain the message scanning screen the
  527. user sees from the door.
  528.  
  529. [4]  REP files
  530.  
  531. [4.1]  Naming convention
  532.  
  533. The reply file is named BBSID.MSG, where BBSID is the ID code for the
  534. BBS found on line 5 of the CONTROL.DAT file.  Once this file has been
  535. created, the mail reader can archive it up into a file with REP exten-
  536. sion.
  537.  
  538. [4.2]  Message file (BBSID.MSG)
  539.  
  540. Replies use the same format as the MESSAGES.DAT file, except that
  541. message number field will contain the conference number instead.  In
  542. other words, the conference number will be placed in the two bytes
  543. (binary) starting at offset 124, as well as the message number field
  544. (ASCII) at offset 2.
  545.  
  546. A private message is indicated by '*' in the message status flag.  For
  547. some reason, most mail doors only accept '*' as a private message and
  548. not '+'.
  549.  
  550. The first 128-bytes record of the file is the header.  Instead of the
  551. copyright notice, it contains the BBSID of the BBS.  This 1-8 charac-
  552. ter BBSID must start at the very first byte and must match what the
  553. BBS has.  The rest of the record is space padded.  The replies start
  554. at record 2.  Each reply message will have a 128-bytes header, plus
  555. one or more for the message text; followed by another header, and so
  556. on.
  557.  
  558. The mail program must check to make sure the BBSID in the first block
  559. of the BBSID.MSG file matches what the BBS has!
  560.  
  561. [4.3]  Door control messages
  562.  
  563. These messages allow the user to change their setup on the BBS by
  564. simply entering a message.  The goal is to allow the user to be able
  565. to control most areas of the BBS via the mail door.  Different mail
  566. doors have different capabilities.  Most all of them offer the ability
  567. to add and drop a conference, as well as reset the last read pointers
  568. in a conference.
  569.  
  570. There are two trends being developed for door control messages.  The
  571. one being referred to as the "old" style accepts one command per mes-
  572. sage (command entered in the subject line); whereas the "new" style
  573. accepts multiple commands per message (commands entered in the message
  574. body).  The old style is by far the more popular but more and more
  575. doors are beginning to offer both.
  576.  
  577. [4.3.1]  DOOR.ID file
  578.  
  579. The DOOR.ID file was first introduced by Greg Hewgill with Tomcat!
  580. mail door and SLMR mail reader.  Since then, many other authors have
  581. picked up this idea and use the format.  This file provides the neces-
  582. sary identifiers a reader needs to send add, drop, etc. messages to
  583. the mail door.  It tells the reader who to address the message to and
  584. what can be put in the subject line.
  585.  
  586. DOOR = <doorname>             This is the name of the door that creat-
  587.                               ed the QWK packet, i.e. <doorname> =
  588.                               Tomcat.
  589. VERSION = <doorversion>       This is the version number of the door
  590.                               that created the packet, i.e.
  591.                               <doorversion> = 2.9.
  592. SYSTEM = <systemtype>         This is the underlying BBS system type
  593.                               and version, i.e. <systemtype> = Wildcat
  594.                               2.55.
  595. CONTROLNAME = <controlname>   This is the name to which the reader
  596.                               should send control messages, eg.
  597.                               <controlname> = TOMCAT.
  598. CONTROLTYPE = <controltype>   This can be one of ADD, DROP, REQUEST,
  599.                               or others.  ADD and DROP are pretty
  600.                               obvious (they work as in MarkMail), and
  601.                               REQUEST is for use with BBS systems that
  602.                               support file attachments.  Try out SLMR
  603.                               with CONTROLTYPE = REQUEST and use the Q
  604.                               function.  (This seems to be a Wildcat!
  605.                               BBS feature.)
  606. RECEIPT                       This flag indicates that the door/BBS is
  607.                               capable of return receipts when a mes-
  608.                               sage is received.  If the first three
  609.                               letters of the subject are RRR, then the
  610.                               door should strip the RRR and set the
  611.                               'return-receipt-requested' flag on the
  612.                               corresponding message.  When the ad-
  613.                               dressee reads this message, the BBS
  614.                               generates a message with the date/time
  615.                               it was read.
  616. MIXEDCASE = YES               If this line is found then the reader
  617.                               will let you use upper and lower case
  618.                               names and subjects.  This is first found
  619.                               in Qmail DeLuxe2 1.25 version.  Most
  620.                               other QWK readers permit the use of
  621.                               mixed case subject lines but force the
  622.                               names to upper case only.
  623. FIDOTAG = YES                 If this line is found then the reader
  624.                               will automatically use FidoNet compliant
  625.                               tag-lines.
  626.  
  627. None of the lines are actually required and they may appear in any
  628. order.  Of course, you would need a CONTROLNAME if you have any
  629. CONTROLTYPE lines.
  630.  
  631. [4.3.2]  Qmail
  632.  
  633. Qmail uses the "new" style of control message; therefore, send a mes-
  634. sage addressed to "QMAIL" with a subject of "CONFIG".  Then, enter any
  635. of the commands listed below inside the text of your message.  Remem-
  636. ber to use one command per line.
  637.  
  638. ADD <confnum>            Add a conference into the Qmail Door scanning
  639.                          list.  "YOURS" can also be added to the com-
  640.                          mand if the user wishes to receive messages
  641.                          only addressed them.  i.e. "ADD 1 YOURS". 
  642.                          "YOURS ALL" can be added to select a confer-
  643.                          ence for all mailed addressed to the user and
  644.                          to "ALL".
  645. DROP <confnum>           Drop a conference from the Qmail Door scan-
  646.                          ning list.  "DROP ALL" wipes the slate clean.
  647. RESET <confnum> <value>  Resets a conference to a particular value.
  648.                          The user can use "HIGH-xxx" to set the con-
  649.                          ference to the highest message in the base.
  650. CITY <value>             Changes the "city" field in the user's
  651.                          PCBoard entry.
  652. PASSWORD <value>         Changes the user's login password.
  653. BPHONE <value>           Business/data phone number
  654. HPHONE <value>           Home/voice phone number
  655. PCBEXPERT <on|off>       Turns the PCBoard expert mode ON or OFF.
  656. PCBPROT <value>          PCBoard file transfer protocol (A-Z).
  657. PAGELEN <value>          Set page length inside PCBoard.
  658. PCBCOMMENT <value>       Set user maintained comment.
  659. AUTOSTART <value>        Qmail Door autostart command.
  660. PROTOCOL <value>         Qmail Door file transfer protocol (A-Z).
  661. EXPERT <ON or OFF>       Turns the Qmail Door expert mode ON or OFF.
  662. MAXSIZE <value>          Maximum size of the user's .QWK packet (in
  663.                          bytes)
  664. MAXNUMBER <value>        Maximum number of messages per conference.
  665. SCANDATE <value>         Changes the date of the last file directory
  666.                          scan to <value>
  667.  
  668.          An example of a message would be:
  669.  
  670.                ADD 1
  671.                ADD 3-10
  672.                DROP 18
  673.                DROP 20-30
  674.                RESET 2 HIGH-20
  675.                RESET 3-10 HIGH-100
  676.                OPTION 29 ON
  677.                PASSWORD F3GUM
  678.                PAGELEN 24
  679.  
  680.          Qmail Door 4.00 will report back to you the results of these
  681.          configuration changes when you upload the reply packet to the Qmail
  682.          Door.
  683.  
  684. [4.3.3]  MarkMail
  685.  
  686. Send a message addressed to "MARKMAIL" with the subject line saying:
  687.  
  688. ADD [value]         in the conference you want to add
  689. DROP                in the conference you want to drop
  690. YOUR [value]        in the conference you want only your mail sent
  691. YA [value]          in the conference you want only your mail + mail
  692.                     addressed to "ALL"
  693. FILES ON or OFF     in any conference to tell MarkMail whether to scan
  694.                     for new files or not.
  695. BLTS ON or OFF      to turn on and off, respectively, of receiving
  696.                     bulletins.
  697. OWN ON or OFF       to turn on and off, respectively, of receiving
  698.                     messages you sent
  699. DELUXE ON or OFF    to turn on and off, respectively, of receiving
  700.                     DeLuxe menu
  701. LIMIT <size>        to set the maximum size of MESSAGES.DAT file can
  702.                     be, it cannot exceed what the Sysop has set up
  703.  
  704. An optional number can be added onto the commands "ADD", "YOUR", and
  705. "YA".  If this number is positive, then it will be treated as an abso-
  706. lute message number.  MarkMail will set your last read pointer to that
  707. number.  If it is negative, MarkMail will set your last read pointer
  708. to the highest minus that number.  For example: "ADD -50" will add the
  709. conference and set the last read pointer to the highest in the confer-
  710. ence minus 50.
  711.  
  712. [4.3.4]  KMail
  713.  
  714. Send a private message addressed to "KMAIL" in the conference that you
  715. want to add, drop, or reset.  The commands are "ADD", "DROP", and
  716. "RESET #", respectively.  The "#" is the message number you want your
  717. last read pointer in the conference be set to.
  718.  
  719. [4.3.5]  RoseMail
  720.  
  721. The RoseMail door allows configuration information be placed in either
  722. the subject line or message text.  The message must be addressed to
  723. "ROSEMAIL".  For only one command, it can be placed in the subject
  724. line.  For more than one changes, the subject line must say "CONFIG"
  725. and each change be placed in the message text.  Every line should be
  726. left justified.  Valid commands are:
  727.  
  728. Command                                           Example
  729. ------------------------------------------------- ------------------
  730. ADD <Conference> [<Message #>] [<Yours>]          ADD 2 -3 Y
  731. DROP <Conference>                                 DROP 2
  732. RESET <Conference> <Message #>                    RESET 12 5000
  733. PCBEXPERT <ON | OFF> - PCBoard expert mode        PCBEXPERT ON
  734. EXPERT <ON | OFF>    - RoseMail expert mode       EXPERT OFF
  735. PCBPROT <A - Z>      - PCBoard protocol           PCBPROT Z
  736. PROT <A - Z>         - RoseMail protocol          PROT G
  737. PAGELEN <Number>     - Page length                PAGELEN 20
  738. MAXSIZE <Kbytes>     - Max packet size in Kb      MAXSIZE 100
  739. MAXNUMBER <max msgs/conference>                   MAXNUMBER 100
  740. JUMPSTART <Sequence or OFF>                       JUMPSTART D;Y;Q
  741. MAXPACKET <max msgs/packet>                       MAXPACKET 500
  742. AUTOSTART <Sequence or OFF> - same as jumpstart   AUTOSTART OFF
  743. OPT <##> <ON | OFF>  - set door option            OPT 2 OFF
  744.  
  745. [4.3.6]  Complete Mail Door
  746.  
  747. Send message to "CMPMAIL", the commands are "ADD" and "DROP".  This
  748. message must be sent in the conference that you want to add or drop.
  749.  
  750. [4.3.7]  The MainMail System
  751.  
  752. Send a message addressed to "MAINMAIL" with the subject line saying:
  753.  
  754. ADD [value]         in the conference you want to add
  755. DROP                in the conference you want to drop
  756. YOURS [value]       in the conference you want only your mail sent
  757. YOURS ALL [value]   in the conference you want only your mail + mail
  758.                     addressed to "ALL"
  759.  
  760. The optional [value] parameter functions identically to the MarkMail
  761. door -- positive number indicates an absolute message number, negative
  762. number will set your last read pointer that many messages from the
  763. last message.
  764.  
  765. [4.3.8]  BGQWK
  766.  
  767. The BGQWK mail door for GT Power supports file request via message. 
  768. To request a file, simply enter a message:
  769.  
  770.      To: BGQWK
  771. Subject: DL:FILENAME.EXT
  772.  
  773. The FILENAME.EXT has to be exact name, wildcard is not supported.  The
  774. message text can be left blank.
  775.  
  776. The only limit on the file request feature is your time and/or your
  777. file ratio.  The transfer of the requested file(s) will start right
  778. after the QWK download is completed.  The only exception is when the
  779. user is using a bidirectional transfer protocol.  There, the REP and
  780. QWK are sent at the same time, hence, the file request cannot be pro-
  781. cessed until the QWK transfer is completed.
  782.  
  783. [4.3.9]  UltraBBS
  784.  
  785. Send a private message addressed to "ULTRABBS" in the conference that
  786. you want to add, drop, or reset.  The commands are "ADD", "DROP", and
  787. "RESET #", respectively.  The "#" is the message number you want your
  788. last read pointer in the conference be set to.  The QWK mail door for
  789. UltraBBS is built in and it generates the DOOR.ID file as well.
  790.  
  791. [4.3.10]  TriMail
  792.  
  793. TriMail is the QWK door for TriBBS.  This door will accept off-line
  794. configuration options sent to Qmail, MarkMail, or TriMail.  This means
  795. you can send the message to: "QMAIL", "MARKMAIL", or "TRIMAIL" in the
  796. appropriate conference and it will work.  The available options are:
  797.  
  798. BLTS ON             Turn bulletin scan on
  799. BLTS OFF            Turn bulletin scan off
  800. FILES ON            Turn new files scan on
  801. FILES OFF           Turn new files scan off
  802. RESET <value>       Reset last message read pointer
  803. DROP                Drop this conference
  804. ADD [value]         Add this conference.  The [value] is optional and
  805.                     will set the last message read pointer.
  806.  
  807. [4.3.11]  Cam-Mail
  808.  
  809. Address your message to either QMAIL or CAM-MAIL.  Then enter the
  810. command in the subject line.  Valid commands are:
  811.  
  812. Add                 Add conferences for scanning
  813. BLTS On             Download all new bulletins in QWK packet
  814. BLTS Off            Turn off download of new bulletins
  815. Color On            Download the QWK packet in color, if available
  816. Color Off           Turn off download in color
  817. Drop                Drop a conference from scanning
  818. Duplicates On       Turn on duplicate checking in REP files
  819. Duplicates Off      Turn off duplicate checking
  820. Files On            Download new files list in QWK packet
  821. Files Off           Turn off download of new files list
  822. Goodbye On          Send the Goodbye files with the QWK packet
  823. Goodbye Off         Does not send the Goodbye files
  824. Mailflags On        Notifies users they have mail
  825. Mailflags Off       Does not notify users of mail
  826. NDX On              Create NDX files for QWK packet
  827. NDX Off             Does not create NDX files
  828. Welcome On          Send the Welcome file with the QWK packet
  829. Welcome Off         Does not send the Welcome file
  830.  
  831. Cam-Mail Gold adds the following commands:
  832. AddY                Adds conference in "YOUR" mail mode
  833. AddB                Adds conference in "YOUR and ALL" mail mode
  834.  
  835. [4.3.12]  QSO
  836.  
  837. QSO supports both "old" and "new" style off-line configuration com-
  838. mands.  For the "old" style, message should be addressed to either
  839. QMAIL or QSO.  The message must be entered in the conference it af-
  840. fects, with the subject line containing:
  841.  
  842. ADD                 Add conference
  843. ADD -20             Add conference and set last read pointer to the
  844.                     highest number in conference minus 20
  845. ADD HIGH-20         Same as above
  846. ADD LOW+50          Add conference and set last read pointer to the
  847.                     lowest number in conference plus 50
  848. ADD 1234            Add conference and set last read pointer to a
  849.                     specific message number
  850. ADD YOURS           Add conference for messages addressed to you only;
  851.                     the YOURS keyword may appear before or after the
  852.                     message number; YOURS may be abbreviated as just Y
  853. DROP                Drop the conference
  854. RESET               Reset last read pointer to highest in conference
  855. RESET -20           Reset to highest number minus 20
  856. RESET HIGH-20       Same as above
  857. RESET LOW+50        Reset to lowest number plus 50
  858. RESET 1234          Reset last read pointer to specific number
  859.  
  860. For the "new" style message, enter the message addressed to either
  861. "QMAIL" or "QSO" with the subject line saying "CONFIG".  The message
  862. text should have commands similar to the ones listed above.  The only
  863. exception is that the conference number must be entered immediately
  864. after the first keyword.  For example:
  865.  
  866. ADD 15 -20          Add conference 15, reset pointer to high minus 20
  867. DROP 137            Drop conference 137
  868. ADD 20 HIGH-50 Y    Add conference 20 for mail addressed to user only,
  869.                     and set the pointer to highest minus 50
  870.  
  871. QSO supports file sending in the mail packet as well.  Attached files
  872. have the name EMnnnnn, where nnnnn is a five digit leading zero padded
  873. number indicating the message number in which the request was sent. 
  874. The plain text file ATTACHED.LST lists the real name of the file, and
  875. has the following format (one line per record):
  876.  
  877.      <conference #>, <message #>, <EMnnnnn filename>, <real name>
  878.  
  879. <conference #>      Conference where the request came from
  880. <message #>         Message number where request came from
  881. <EMnnnnn filename>  File as named inside the QWK file
  882. <real name>         Original filename as seen on the BBS
  883.  
  884. For messages that has an enclosed file, the last line of the message
  885. has the line: 
  886.  
  887. *Enclosed file: filename.ext
  888.  
  889. The reader program must send a request to obtain this file.  The re-
  890. quest is in the format similar to any other control messages:
  891.  
  892. To: QSO
  893. Subject: REQUEST nnnnn
  894.  
  895. where nnnnn is the message number that contains this attached file. 
  896. This message must be sent in the conference where that contains that
  897. message.  Alternatively, the "new" style can also be used.  With the
  898. line "REQUEST confnum nnnnn" in the message text.
  899.  
  900. To upload a file that is attached to a message, the file ATTXREF.DAT
  901. must be created.  The file is a plain text file with one line corre-
  902. sponding to each message in the reply file.  Blank lines must be in-
  903. cluded for those messages that do not have files attached to them.  A
  904. non-blank line has the following format to indicate a file is attached
  905. to that message:
  906.  
  907. <internal name>, <real name>
  908.  
  909. <internal name>     is any non-conflicting filename
  910. <real name>         the name as it should appear on the BBS
  911.  
  912. [4.3.13]  TGWave
  913.  
  914. Send config messages in the area the changes are to take effect.  In
  915. addition to normal ADD, DROP, RESET commands, the door responds to
  916. the following config messages:
  917.  
  918.            "ADD YOURS" ┐  Selects the area,
  919.            "ADD Y"     ├  toggles it to personal
  920.            "YOURS"     ┘  messages only.
  921.            
  922.            "ADD YA"    ┐  Selects the area, toggles it
  923.            "YOURS ALL" ├  to personal messages, and messages
  924.            "YA"        ┘  to "All" only.
  925.  
  926. TGWave processes QWK offline configuration requests that are addressed
  927. to one of the following names: "TELEGARD", "QMAIL", "ROSEMAIL" (case-
  928. insensitive), in addition to "TGWAVE".
  929.  
  930.  
  931. [4.4]  Turning off the echo flag
  932.  
  933. In order to send a non-echoed message (not send out to other BBSs), a
  934. user can enter "NE:" in front of the subject line.  This feature may
  935. not be offered in all mail doors.
  936.  
  937. Some mail doors strip out the "NE:" from the subject line.  However,
  938. that leaves the recipient with nothing to tell that the message was
  939. not echoed.  Therefore, it is better if "NE:" is not stripped.
  940.  
  941. [4.5]  Tag-lines
  942.  
  943. The most common format for a reader tag-line is:
  944.  
  945. ---
  946.  * My reader v1.00 * The rest of the tag-line.
  947.  
  948. (The asterisks above should be replaced by IBM extended character
  949. number 254 - a square block.)
  950.  
  951. The three dashes is called a tear-line.  The tag-line is appended to
  952. the end of the message and is usually one line only.  It is preferred
  953. that tag-lines conform to this format so that networking softwares
  954. such as QNet and RNet will not add another tearline to the message
  955. when they process it.
  956.  
  957. Softwares on FidoNet does not like mail readers adding a tear-line of
  958. their own, so if your mail reader offers a FidoNet mode, you will need
  959. to get rid of the tear-line.  Another item which differs between the
  960. FidoNet and PC-based networks is that FidoNet does not like extended
  961. ASCII characters.  So your reader may want to strip high ASCII if the
  962. user has FidoNet mode on.  Acceptable tag-line style, I believe, is
  963. just this:
  964.  
  965.  * My Reader v1.00 * The rest of the tag-line.
  966.  
  967. [5]  Net mail
  968.  
  969. QWK mail doors can be used along or in conjunction with QWK network
  970. softwares to operate a network.  Many such network exists.  A Net-
  971. Status packet (one that can be imported to BBS message base) is very
  972. similar to a normal mail packet users get.  The only difference is at
  973. the end of the MESSAGES.DAT file.  There, a series of 128 byte blocks
  974. are appended to indicate Net-Status.  
  975.  
  976. One byte represent one conference, in groups of 128.  A non-zero value
  977. means the user is allowed Net Mail status for that conference.  The
  978. number of Net Status blocks appended to the MESSAGES.DAT file only
  979. needs to cover the highest conference the user has access to.
  980.  
  981. The reason these packets have to be different?  Using QWK mail doors
  982. to send and receive messages require you to be able to send messages
  983. in other user's name as well as receive private messages in conferenc-
  984. es.  The Net-Status tells the mail door to import the messages even if
  985. they are from another name.
  986.  
  987. The only weird implementation here is that the block with the highest
  988. conference numbers come before the lower ones.  Hence, to illustrate:
  989.  
  990.        Conference 128
  991.        |  Conference 129
  992.        |  |
  993.       vv vv
  994. 0000  00 00 FF 00 00 00 00 00-00 00 00 00 00 00 00 00  Flags for
  995. 0010  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  conferences
  996. 0020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  128-255
  997. 0030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
  998. 0040  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
  999. 0050  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
  1000. 0060  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
  1001. 0070  00 00 00 00 00 00 00 00-00 00 00 00 00 00 FF 00
  1002.  
  1003.        Conference 0
  1004.        |  Conference 1
  1005.        |  |
  1006.       vv vv
  1007. 0080  00 FF 00 00 00 00 00 00-00 00 00 00 00 00 00 00  Flags for
  1008. 0090  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  conferences
  1009. 00A0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  0-127
  1010. 00B0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
  1011. 00C0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
  1012. 00D0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
  1013. 00E0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
  1014. 00F0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 FF
  1015.  
  1016. This example shows that this user has Net Status in conferences 1,
  1017. 127, 130, and 254.
  1018.  
  1019. MarkMail and KMail doors (both for PCBoard) choos to implement things
  1020. a little differently.  Instead of appending Net-Status blocks to the
  1021. end of the MESSAGES.DAT file, they simply put "MarkMail" or "Kmail..."
  1022. in the first 8 position of the file and the user is granted Net-Status
  1023. in all conferences.
  1024.  
  1025.                      -=-=-=-=-=-=-<>-=-=-=-=-=-=-
  1026.  
  1027. [A]  Credits and Contributions
  1028.  
  1029. Mark "Sparky" Herring, who originated the QWK-format.
  1030.  
  1031. Tim Farley, who started this documentation back in the summer of 1990. 
  1032. The general outline here is the work of Tim.  I filled in the blanks.
  1033.  
  1034. Jeffery Foy, who gave us the format for Microsoft single binary versus
  1035. IEEE format.
  1036.  
  1037. Greg Hewgill, who (if I remember correctly) wrote the Turbo Pascal
  1038. routines (included in here) to convert between MKS and TP LongInt.
  1039.  
  1040. Dennis McCunney, who is the host of the Off-line conference on RIME,
  1041. is very knowledgeable in off-line reading concept and programs.  His
  1042. goal is to have one reader that can read mail packet from any source.
  1043.  
  1044. Cody Gibson and Jeffery Foy, whose information on Net-Status packet
  1045. are included here.
  1046.  
  1047. All those who have been around the Off-line conferences on ILink (the
  1048. oldest of the four I participate), RIME, Fido, and Intelec, who have
  1049. provided great help over the past three years.  The bulk of the infor-
  1050. mation presented here are from messages in those conferences.  These
  1051. people include, but are no limited to, the followings: Dane Beko,
  1052. Joseph Carnage, Marcos Della, Joey Lizzi, Mark May, and Jim Smith.
  1053.  
  1054. [B]  Sample Turbo Pascal and C code
  1055.  
  1056. Here are a few routines in Turbo Pascal and C to convert Microsoft
  1057. BASIC MKS format to usable IEEE long integer.  These are collected
  1058. over the networks and there is no guarantee that they will work for
  1059. you!
  1060.  
  1061. Turbo Pascal (Greg Hewgill ?):
  1062.  
  1063. type
  1064.      bsingle = array [0..3] of byte;
  1065.  
  1066. { converts TP real to Microsoft 4 bytes single }
  1067.  
  1068. procedure real_to_msb (preal : real; var b : bsingle);
  1069. var
  1070.      r : array [0 .. 5] of byte absolute preal;
  1071. begin
  1072.      b [3] := r [0];
  1073.      move (r [3], b [0], 3);
  1074. end; { procedure real_to_msb }
  1075.  
  1076. { converts Microsoft 4 bytes single to TP real }
  1077.  
  1078. function msb_to_real (b : bsingle) : real;
  1079. var
  1080.      preal : real;
  1081.      r : array [0..5] of byte absolute preal;
  1082. begin
  1083.      r [0] := b [3];
  1084.      r [1] := 0;
  1085.      r [2] := 0;
  1086.      move (b [0], r [3], 3);
  1087.      msb_to_real := preal;
  1088. end; { function msb_to_real }
  1089.  
  1090. Another Turbo Pascal routine to convert Microsoft single to TP LongInt
  1091. (Marcos Della):
  1092.  
  1093. index := ((mssingle and not $ff000000) or $00800000) shr (24 -
  1094. ((mssingle shr 24) and $7f)) - 1;
  1095.  
  1096. C (identify yourself if you wrote this routine):
  1097.  
  1098. /* converts 4 bytes Microsoft MKS format to long integer */
  1099.  
  1100. unsigned long mbf_to_int (m1, m2, m3, exp)
  1101. unsigned int m1, m2, m3, exp;
  1102. {
  1103.      return (((m1 + ((unsigned long) m2 << 8) + ((unsigned long) m3 <<
  1104.      16)) | 0x800000L) >> (24 - (exp - 0x80)));
  1105. }
  1106.  
  1107. Microsoft binary (by Jeffery Foy):
  1108.  
  1109.    31 - 24    23     22 - 0        <-- bit position
  1110. +-----------------+----------+
  1111. | exponent | sign | mantissa |
  1112. +----------+------+----------+
  1113.  
  1114. IEEE (C/Pascal/etc.):
  1115.  
  1116.    31     30 - 23    22 - 0        <-- bit position
  1117. +----------------------------+
  1118. | sign | exponent | mantissa |
  1119. +------+----------+----------+
  1120.  
  1121. In both cases, the sign is one bit, the exponent is 8 bits, and the
  1122. mantissa is 23 bits.  You can write your own, optimized, routine to
  1123. convert between the two formats using the above bit layout.
  1124.  
  1125. [C]  Sample message
  1126.  
  1127. Here is a sample message in hex and ASCII format:
  1128.  
  1129. 019780  20 34 32 33 32 20 20 20 30 32 2D 31 35 2D 39 32   4232   02-15-92
  1130. 019790  31 33 3A 34 35 52 49 43 48 41 52 44 20 42 4C 41  13:45RICHARD BLA
  1131. 0197A0  43 4B 42 55 52 4E 20 20 20 20 20 20 20 20 53 54  CKBURN        ST
  1132. 0197B0  45 56 45 20 43 4F 4C 45 54 54 49 20 20 20 20 20  EVE COLETTI     
  1133. 0197C0  20 20 20 20 20 20 20 51 45 44 49 54 20 48 41 43         QEDIT HAC
  1134. 0197D0  4B 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  K               
  1135. 0197E0  20 20 20 20 20 20 20 20 20 20 20 20 34 30 33 36              4036
  1136. 0197F0  20 20 20 20 37 20 20 20 20 20 E1 0A 01 00 00 20      7           
  1137. 019800  2A 20 49 6E 20 61 20 6D 65 73 73 61 67 65 20 64  * In a message d
  1138. 019810  61 74 65 64 20 30 32 2D 30 39 2D 39 32 20 74 6F  ated 02-09-92 to
  1139. 019820  20 53 74 65 76 65 20 43 6F 6C 65 74 74 69 2C 20   Steve Coletti, 
  1140. 019830  52 69 63 68 61 72 64 20 42 6C 61 63 6B 62 75 72  Richard Blackbur
  1141. 019840  6E 20 73 61 69 64 3A E3 E3 52 42 3E 53 43 20 AF  n said:  RB>SC  
  1142. 019850  20 65 64 69 74 6F 72 20 69 6E 20 74 68 65 20 28   editor in the (
  1143. 019860  6D 61 69 6E 66 72 61 6D 65 29 20 56 4D 2F 43 4D  mainframe) VM/CM
  1144. 019870  53 20 70 72 6F 64 75 63 74 20 6C 69 6E 65 20 69  S product line i
  1145. [ etc. ]
  1146. 019A00  6E 6F 74 20 61 20 44 6F 63 74 6F 72 2C 20 62 75  not a Doctor, bu
  1147. 019A10  74 20 49 20 70 6C 61 79 20 6F 6E 65 20 61 74 20  t I play one at 
  1148. 019A20  74 68 65 20 48 6F 73 70 69 74 61 6C 2E E3 20 20  the Hospital.   
  1149. 019A30  20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
  1150. 019A40  20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
  1151. 019A50  20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
  1152. 019A60  20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
  1153. 019A70  20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
  1154. 019A80  E3 50 43 52 65 6C 61 79 3A 4D 4F 4F 4E 44 4F 47   PCRelay:MOONDOG
  1155. 019A90  20 2D 3E 20 23 33 35 20 52 65 6C 61 79 4E 65 74   -> #35 RelayNet
  1156. 019AA0  20 28 74 6D 29 E3 34 2E 31 30 20 20 20 20 20 20   (tm) 4.10      
  1157. 019AB0  20 20 20 20 20 20 20 20 20 48 55 42 4D 4F 4F 4E           HUBMOON
  1158. 019AC0  2D 4D 6F 6F 6E 44 6F 67 20 42 42 53 2C 20 42 72  -MoonDog BBS, Br
  1159. 019AD0  6F 6F 6B 6C 79 6E 2C 4E 59 20 37 31 38 20 36 39  ooklyn,NY 718 69
  1160. 019AE0  32 2D 32 34 39 38 E3 20 20 20 20 20 20 20 20 20  2-2498          
  1161. 019AF0  20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
  1162.  
  1163. [D]  Sample index file
  1164.  
  1165. Here is a sample index file in hex format:
  1166.  
  1167. 000000  00 00 28 87 19 00 00 30 87 19 00 00 38 87 19 00
  1168. 000010  00 7E 87 19 00 00 07 88 19 00 00 0B 88 19 00 00
  1169. 000020  0F 88 19 00 00 14 88 19 00 00 19 88 19 00 00 1E
  1170. 000030  88 19 00 00 22 88 19 00 00 27 88 19 00 00 2C 88
  1171. 000040  19 00 00 31 88 19 00 00 3B 88 19 00 00 40 88 19
  1172. 000050  00 00 46 88 19 00 00 49 88 19 00 00 4D 88 19 00
  1173. 000060  00 52 88 19 00 00 55 88 19 00 00 59 88 19 00 00
  1174. 000070  60 88 19 00 00 66 88 19 00 00 70 88 19
  1175.  
  1176. This index file is for conference 25.  The values for the offset are as
  1177. follows: 84, 88, 92, 127, 135, 139, 143, 148, 153, 158, 162, 167, 172,
  1178. 177, 187, 192, 198, 201, 205 210, 213, 217, 224, 230, and 240.
  1179.